package com.group9.handinhand.service.so;

import org.apache.commons.lang.ArrayUtils;

import com.group9.handinhand.dao.model.Friendship;

/**
 * Class for service of Friendship
 * @author Egeid
 *
 */
public class FriendshipSO extends AbstractBaseSO {
	private UserSO firstUser;
	private UserSO secondUser;
	/**
	 * converts to friendship model object
	 * @param ignoreProperties
	 * @return
	 */
	public Friendship convertToModelObject(String... ignoreProperties) {
		Friendship model = (Friendship) convert(new Friendship(),
				(String[]) ArrayUtils.addAll(ignoreProperties,new String[]{"firstUser","secondUser"}));
		model.setFirstUser(this.firstUser.convertToModelObject(new String[]{"socialUser"}));
		model.setSecondUser(this.secondUser.convertToModelObject(new String[]{"socialUser"}));
		return model;
	}

	public UserSO getFirstUser() {
		return firstUser;
	}

	public void setFirstUser(UserSO firstUser) {
		this.firstUser = firstUser;
	}

	public UserSO getSecondUser() {
		return secondUser;
	}

	public void setSecondUser(UserSO secondUser) {
		this.secondUser = secondUser;
	}

	@Override
	public String toString() {
		return "FriendshipSO [firstUser=" + firstUser + ", secondUser="
				+ secondUser + "]";
	}
}
